/**
 * Copyright JS Foundation and other contributors, http://js.foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

.nr-ui-view-lasso {
    stroke-width: 1px;
    stroke: var(--red-ui-view-lasso-stroke);
    fill: var(--red-ui-view-lasso-fill);
    stroke-dasharray: 10 5;
}

.nr-ui-view-slice {
    stroke-width: 1px;
    stroke: var(--red-ui-view-lasso-stroke);
    fill: none;
    stroke-dasharray: 10 5;
}

.node_label_italic, // deprecated: use red-ui-flow-node-label-italic
.red-ui-flow-node-label-italic {
    font-style: italic;
}
.red-ui-flow-node-label-white {
    fill: var(--red-ui-view-background) !important;
}
.red-ui-flow-node-label {
    stroke-width: 0;
    fill: var(--red-ui-node-label-color);
    font-size: 14px;
    pointer-events: none;
    -webkit-touch-callout: none;
    @include disable-selection;

    .red-ui-flow-node-label-text {
        dominant-baseline: middle;
    }

    &.red-ui-flow-node-label-right .red-ui-flow-node-label-text {
        text-anchor: end;
    }
}

.red-ui-flow-port-label {
    stroke-width: 0;
    fill: var(--red-ui-node-port-label-color);
    font-size: 16px;
    dominant-baseline: middle;
    text-anchor: middle;
    pointer-events: none;
    -webkit-touch-callout: none;
    @include disable-selection;
}


.red-ui-flow-node {
    stroke: var(--red-ui-node-border);
    cursor: move;
    stroke-width: 1;
    .red-ui-workspace-locked & {
        cursor: pointer;
    }
}
.red-ui-workspace-select-mode {
    g.red-ui-flow-node.red-ui-flow-node-hovered * {
        cursor: pointer !important
    }
    g.red-ui-flow-node, g.red-ui-flow-link {
        opacity: 0.5;
    }
    g.red-ui-flow-node.red-ui-flow-node-hovered:not(.red-ui-flow-node-selected) {
        opacity: 0.9;
        .red-ui-flow-node {
            stroke-width: 2;
            stroke: var(--red-ui-node-selected-color) !important;
            stroke-dasharray: 10, 4;
        }
    }
}

.red-ui-flow-group {
    &.red-ui-flow-group-hovered {
        .red-ui-flow-group-outline-select-line {
            stroke-opacity: 0.8 !important;
            stroke-dasharray: 10 4 !important;
        }
        .red-ui-flow-group-outline-select-outline {
            stroke-opacity: 0.8 !important;
        }
    }
    &.red-ui-flow-group-active-hovered:not(.red-ui-flow-group-hovered) {
        .red-ui-flow-group-outline-select {
            stroke: var(--red-ui-link-link-color);
        }
    }
}

.red-ui-flow-group-outline {
    fill: none;
    stroke: var(--red-ui-node-selected-color);
    stroke-opacity: 0;
    stroke-width: 12;
    pointer-events: stroke;
}
.red-ui-flow-group-outline-select {
    cursor: move;
    fill: none;
    stroke: var(--red-ui-node-selected-color);
    pointer-events: none;
    stroke-opacity: 0;
    stroke-width: 2;

    &.red-ui-flow-group-outline-select-outline {
        stroke: var(--red-ui-view-background);
        stroke-width: 4;
    }
    &.red-ui-flow-group-outline-select-background {
        fill: white;
        fill-opacity: 0;
        pointer-events: stroke;
        stroke-width: 16;
    }
}

svg:not(.red-ui-workspace-lasso-active) {
    .red-ui-flow-group:not(.red-ui-flow-group-selected) {
        .red-ui-flow-group-outline-select.red-ui-flow-group-outline-select-background:hover {
            ~ .red-ui-flow-group-outline-select {
                stroke-opacity: 0.4 !important;
            }
            ~ .red-ui-flow-group-outline-select-line {
                stroke-dasharray: 10 4 !important;
            }
        }
    }
}

.red-ui-flow-group-body {
    pointer-events: none;
    fill: var(--red-ui-group-default-fill);
    fill-opacity: var(--red-ui-group-default-fill-opacity);
    stroke-width: 2;
    stroke: var(--red-ui-group-default-stroke);
    stroke-opacity: var(--red-ui-group-default-stroke-opacity);
}
.red-ui-flow-group-label {
    @include disable-selection;
    fill: var(--red-ui-group-default-label-color);
}



.red-ui-flow-node-unknown {
    stroke-dasharray:10,4;
    stroke: var(--red-ui-node-border-unknown);
}
.red-ui-flow-node-placeholder {
    stroke-dasharray:10,4;
    stroke: var(--red-ui-node-border-placeholder);
    fill: var(--red-ui-node-background-placeholder);
    opacity: 0.5;
    stroke-width: 2;
}
.red-ui-flow-node-icon-group {
    text {
        @include disable-selection;
    }
    .fa-lg {
        @include disable-selection;
        stroke: none;
        fill: var(--red-ui-node-icon-color);
        text-anchor: middle;
        font-family: FontAwesome;
    }
}
.red-ui-flow-node-icon-shade {
    stroke: none;
    fill: var(--red-ui-node-icon-background-color-fill);
    fill-opacity: var(--red-ui-node-icon-background-color-opacity);
}
.red-ui-flow-node-icon-shade-border {
    stroke-opacity: var(--red-ui-node-icon-border-color-opacity);
    stroke: var(--red-ui-node-icon-border-color);
    stroke-width: 1;
}

.red-ui-flow-node-button {
    fill: inherit;
    &.red-ui-flow-node-button-disabled {
        opacity: 0.4;
        .red-ui-flow-node-button-button {
            cursor: default;
        }
    }
    &.red-ui-flow-node-button-stopped {
        opacity: 0.4;
        .red-ui-flow-node-button-button {
            cursor: default;
            pointer-events: none;
        }
    }
}
.red-ui-flow-node-button-button {
    cursor: pointer;
}
.red-ui-flow-node-button-background {
    fill: var(--red-ui-node-background-placeholder);
}

.red-ui-flow-port {
    stroke: var(--red-ui-node-border);
    stroke-width: 1;
    fill: var(--red-ui-node-port-background);
    cursor: crosshair;
}

.red-ui-flow-node-error {
    fill: var(--red-ui-node-status-error-background);
    stroke: var(--red-ui-node-status-error-border);
    stroke-width:1px;
    cursor: default;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.red-ui-flow-node-changed {
    fill: var(--red-ui-node-status-changed-background);
    stroke: var(--red-ui-node-status-changed-border);
    cursor: default;
    stroke-width:1px;
    stroke-linejoin: round;
    stroke-linecap: round;
}

g.red-ui-flow-node-selected {
    .red-ui-workspace-select-mode & {
        opacity: 1;
    }
    .red-ui-flow-node,.red-ui-flow-subflow-port {
        stroke-width: 2;
        stroke: var(--red-ui-node-selected-color) !important;
    }
}
.red-ui-flow-node-highlighted {
    border-color: var(--red-ui-node-selected-color) !important;
    border-style: dashed !important;
    stroke: var(--red-ui-node-selected-color);
    stroke-width: 3;
    stroke-dasharray: 8, 4;
}

.red-ui-flow-subflow .red-ui-flow-node {
}

.red-ui-workspace-disabled {
    .red-ui-flow-node {
        stroke-dasharray: 8, 3;
        fill-opacity: 0.5;
    }
    .red-ui-flow-link-line {
        stroke-dasharray: 10,8 !important;
        stroke-width: 2 !important;
        stroke: var(--red-ui-link-disabled-color);
    }
    .red-ui-flow-port {
        fill-opacity: 1;
        stroke-dasharray: none;
    }
    .red-ui-flow-group, .red-ui-flow-group-body {
        stroke-dasharray: 8, 3;
    }
}
.red-ui-flow-node-disabled {
    &.red-ui-flow-node, .red-ui-flow-node {
        stroke-dasharray: 8, 3;
        fill-opacity: 0.5;
    }
    &.red-ui-flow-link-line {
        stroke-dasharray: 10,8 !important;
        stroke-width: 2 !important;
        stroke: var(--red-ui-link-disabled-color);
    }
    .red-ui-flow-port {
        fill-opacity: 1;
        stroke-dasharray: none;
    }
}
@each $current-color in red green yellow blue grey gray {
    .red-ui-flow-node-status-dot-#{""+$current-color} {
        fill: var(--red-ui-node-status-colors-#{"" + $current-color});
        stroke: var(--red-ui-node-status-colors-#{"" + $current-color});
    }
    .red-ui-flow-node-status-ring-#{""+$current-color} {
        fill: var(--red-ui-view-background);
        stroke: var(--red-ui-node-status-colors-#{"" + $current-color});
    }
}
.red-ui-flow-node-status-background {
    stroke: none;
    fill: var(--red-ui-view-background);
    fill-opacity: 0.9;
}
.red-ui-flow-node-status-label {
    @include disable-selection;
    stroke-width: 0;
    fill: var(--red-ui-secondary-text-color);
    font-size:9pt;
    text-anchor:start;
}

#red-ui-workspace:not(.red-ui-workspace-locked) {
    .red-ui-flow-port-hovered {
        stroke: var(--red-ui-port-selected-color);
        fill:  var(--red-ui-port-selected-color);
    }
}

.red-ui-flow-subflow-port {
    fill: var(--red-ui-node-background-placeholder);
    stroke: var(--red-ui-node-border);
}

.red-ui-flow-drag-line {
    stroke: var(--red-ui-node-selected-color) !important;
    stroke-width: 3;
    fill: none;
    pointer-events: none;
}

.red-ui-flow-link-line {
    stroke: var(--red-ui-link-color);
    stroke-width: 3;
    fill: none;
    pointer-events: none;
}
.red-ui-flow-link-link {
    stroke-width: 2;
    stroke: var(--red-ui-link-link-color);
    fill: none;
    stroke-dasharray: 25,4;
}
.red-ui-flow-link-off-flow {
    stroke-width: 2;
}

.red-ui-flow-link-port {
    fill: var(--red-ui-node-link-port-background);
    stroke: var(--red-ui-link-link-color);
    stroke-width: 1;
}
.red-ui-flow-link-group-active .red-ui-flow-link-port {
    stroke: var(--red-ui-link-link-active-color);
}
.red-ui-flow-link-group:hover {
    cursor: pointer;
}

.red-ui-flow-link-outline {
    stroke: var(--red-ui-view-background);
    stroke-opacity: 0.4;
    stroke-width: 5;
    cursor: crosshair;
    fill: none;
    pointer-events: none;
}
.red-ui-flow-link-background {
    stroke: var(--red-ui-view-background);
    opacity: 0;
    stroke-width: 20;
    cursor: crosshair;
    fill: none;
}
.red-ui-flow-link-splice > .red-ui-flow-link-line {
    stroke-dasharray: 15,8;
}

g.red-ui-flow-link-selected path.red-ui-flow-link-line {
    stroke: var(--red-ui-node-selected-color);
}
g.red-ui-flow-link-unknown path.red-ui-flow-link-line {
    stroke: var(--red-ui-link-unknown-color);
    stroke-width: 2;
    stroke-dasharray: 10, 4;
}

// @keyframes *must* be on multiple lines so build-custom-theme can filter them out
@keyframes red-ui-flow-port-tooltip-fadeIn {
    from { opacity:0; } to { opacity:1; }
}

.red-ui-flow-port-tooltip {
    opacity:0;
    animation: 0.1s ease-in 0s 1 normal forwards red-ui-flow-port-tooltip-fadeIn;
    pointer-events: none;

    path:first-child {
        fill: var(--red-ui-popover-background);
        stroke: var(--red-ui-popover-background);
        stroke-width: 1;
    }
}
.red-ui-flow-port-tooltip-label {
    stroke-width: 0;
    fill: var(--red-ui-popover-color);
    font-family: var(--red-ui-primary-font);
    font-size: 12px;
    pointer-events: none;
    -webkit-touch-callout: none;
    white-space: pre;
    @include disable-selection;
}
.red-ui-flow-junction-dragging {
    .red-ui-flow-junction-background {
        background: red !important
    }
}
.red-ui-flow-junction:not(.red-ui-flow-junction-dragging):hover {
    .red-ui-flow-junction-background {
        transform: scale(1.4);
        stroke-width: 0.6;
    }
    .red-ui-flow-junction-port {
        opacity: 1;
        pointer-events: auto;
    }
    .red-ui-flow-junction-port-input {
        transform: translate(-10px,0)
    }
    .red-ui-flow-junction-port-output {
        transform: translate(10px,0)
    }
}
.red-ui-flow-junction-port {
    stroke: var(--red-ui-node-border);
    stroke-width: 1;
    fill: var(--red-ui-node-port-background);
    cursor: crosshair;
    transition: transform 0.1s;
    opacity: 0;
    pointer-events: none;
}
.red-ui-flow-junction-background {
    stroke: var(--red-ui-node-border);
    stroke-width: 1;
    fill: var(--red-ui-node-port-background);
    cursor: crosshair;
    transform: scale(1);
    transition: transform 0.1s;
    &:hover {

    }
}
.red-ui-flow-junction-hovered {
    stroke: var(--red-ui-port-selected-color);
    fill:  var(--red-ui-port-selected-color);
}
.red-ui-flow-junction.selected .red-ui-flow-junction-background {
    stroke: var(--red-ui-port-selected-color);
    // fill:  var(--red-ui-port-selected-color);
}
